/*
* @Author: admin
* @Date:   2017-08-14 18:50:00
* @Last Modified by:   admin
* @Last Modified time: 2017-08-15 10:40:26
*/





$(function(){

    $('.ruleAnduser>ul>li:nth-child(1)').on('click', function() {
        $('.ruleAnduser>ul>li:nth-child(1)').css("color","#f13435");
        $('.ruleAnduser>ul>li:nth-child(2)').css("color","#f13435");
        $('.rule').css("display", "block").addClass("myMoveleft");
        $('.user').css("display", "none");
        $('.ruleAnduser>ul>li:nth-child(1)').css("border-bottom", "2px solid #f13435");
        $('.ruleAnduser>ul>li:nth-child(2)').css("border-bottom", "none");
    });

    $('.ruleAnduser>ul>li:nth-child(2)').on('click', function() {
        $('.ruleAnduser>ul>li:nth-child(1)').css("color","#888888");
        $('.ruleAnduser>ul>li:nth-child(2)').css("color","#f13435");
        $('.rule').css("display", "none");
        $('.user').css("display", "block").addClass("myMoveright");
        $('.ruleAnduser>ul>li:nth-child(1)').css("border-bottom", "none");
        $('.ruleAnduser>ul>li:nth-child(2)').css("border-bottom", "2px solid #f13435");
    });

    $('.btn-faceToface').on('click',function(){
        $('#blackground').removeClass('bgout').addClass("bgin").css("display","block");
        $('#faceToface').removeClass('faceleave ').addClass("facefromleft").css("display","block");
    });

    $('#blackground,#faceToface').on('click',function(){
        $('#blackground').removeClass('bgin').addClass("bgout");
        $('#faceToface').removeClass('facefromleft').addClass("faceleave");
        setTimeout(function(){
            $('#blackground').css("display","none");
            $('#faceToface').css("display","none");
        },900)
    });

    // 获取参数
       function getQueryString(name) { 
             var reg     = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
             var result  = window.location.search.substr(1).match(reg);
             return result ? decodeURIComponent(result[2]) : null;
        }

        var url='http://jkl.juyingtech.com/sklmall/front/share/shareUrl.htm';       
        var _mobile = getQueryString("mobile")||getQueryString("moblie");
        var jiangchuan_url=url+'?mobile='+_mobile+"&type=1";

    // 生成二维码 
        var qrcode = new QRCode(document.getElementById("qrcode"), {
            width : 100,//设置宽高
            height : 100
        });
        qrcode.makeCode(jiangchuan_url);



   var listPanel = $('.activity ul');
            var nubcers = 0;//向上滚动top值
            var lilist=document.querySelectorAll('#J_Activity li'); 
            
            if(lilist.length>4){
                function up() {//向上滚动
                    listPanel.animate({//中奖结果
                        'top': (nubcers - 35) + 'px'
                    }, 1500, 'linear', function () {
                        listPanel.css({'top': '0px'})
                        .find("li:first").appendTo(listPanel);
                        up();
                        });
            }
            up();
        }
    
})


